<?
include_once 'include/include.php';
c_create::createClass('setPage');
$page = new setPage();
c_create::createClass('adv');
$adv = new adv();
$outvar[headline] = '广告管理列表';
if ($_GET[did]){
	if ($adv->deleteRecord($_GET[did])){
		$_SESSION[showtips]	 = '删除成功！';
	}else {
		$_SESSION[showtips]	 = '删除失败！';
	}
}

$where = $dbtable->adv." a left join ".$dbtable->advcata." b on(a.CAid=b.CAid) where a.Ashow='y' and b.CAtype=0 ";
if ($_GET[CAid]){
	$where .= ' and a.CAid='.$_GET[CAid];
	$outvar[CAid] = $_GET[CAid];
}

$where = " $where order by a.Atop desc,a.Adid desc";
$query = "select count(*) from ".$where;
$page->setPagePHP(20,10,$dbconn->Getonefield($query));
$query = "select a.*,b.CAcataname from ".$where.$page->limit;
$nowQueryid = $dbconn->Query($query);
$i = 0;
while (($row = $dbconn->next_record($nowQueryid))){
	$row[num] = $i+1;
	$array[] = $row;
	$i++;
}
$outvar[page] = $page->menuAll;
$outvar[record] = $array;
$outvar[fileurl_1] = getFileWithVar('',array('id','did'));
$outvar[fileurl_2] = getFileWithVar('',array('id','did','CAid'));
$outvar[typelist] = $adv->getTypeList(0);

require_once("./include/xajax_common.php");
$outvar[xajax_javascript] = $xajax->getJavascript('../lib/xajax/');

outFile("homeface_manage");
?>